package com.zqu.controller;

import com.zqu.pojo.ClientServe;
import com.zqu.service.ClientServeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("reimbursementcheck")
public class ReimbursementCheckController {
    @Autowired
    private ClientServeService clientServeService;

    @RequestMapping("find ReimbursementCheck")
    @ResponseBody
    public ClientServe findReimbursementCheck(){
        ClientServe clientServe = new ClientServe();
        clientServe.setClientId(1);
        System.out.println(clientServeService.findServe(clientServe.getId()).toString());
        return clientServeService.findServe(clientServe.getId());
    }
    @RequestMapping("findReimbursementCheckList")
    @ResponseBody
    public List<ClientServe> findReimbursementCheckList(){
        ClientServe clientServe = new ClientServe();
        clientServe.setClientId(1);
        System.out.println("all list"+clientServe+clientServeService);
        System.out.println(clientServeService.selectList(clientServe).toString());
        return clientServeService.selectList(clientServe);
    }
    @RequestMapping("updateReimbursementCheck")
    @ResponseBody
    public boolean updateReimbursementCheck(){
        ClientServe clientServe = new ClientServe();
//        serve = null;
//        serve.setId(3);
        clientServe.setId(1);
        clientServe.setServeEvaluate("dfdhgf");
        System.out.println("update ");
        boolean flag = clientServeService.updateT(clientServe);
        if(flag){
            System.out.println("修改成功");
        }else {
            System.out.println("修改失败");
        }

        return flag;
    }
    @RequestMapping("insertReimbursementCheck")
    @ResponseBody
    public boolean insertReimbursementCheck(){
        ClientServe clientServe = new ClientServe();

     clientServe.setClientId(1);
     clientServe.setReimbursementId(1);
     clientServe.setClientId(1);
     clientServe.setServiceDistributionUserid(1);

        System.out.println("update ");
        boolean flag = clientServeService.insertT(clientServe);
        if(flag){
            System.out.println("修改成功");
        }else {
            System.out.println("修改失败");
        }

        return flag;
    }
    @RequestMapping("deleteReimbursementCheck")
    @ResponseBody
    public boolean deleteReimbursementCheck(){



        boolean flag = clientServeService.deleteT(1);
        if(flag){
            System.out.println("修改成功");
        }else {
            System.out.println("修改失败");
        }

        return flag;
    }
    @RequestMapping("deleteReimbursementCheckList")
    @ResponseBody
    public boolean deleteReimbursementCheckList(){
        String ids[] ={"5","6"};
        boolean flag = clientServeService.deleteTByIds(ids);
        if(flag){
            System.out.println("修改成功");
        }else {
            System.out.println("修改失败");
        }

        return flag;
    }
}
